/****************************************************************************************** 
 *	ActionScript JSFL API is under an MIT license.
 *
 *	Copyright (c) 2010 Digital Primates IT Consulting Group
 *
 *	Permission is hereby granted, free of charge, to any person obtaining a copy of this
 *	software and associated documentation files (the "Software"), to deal in the Software 
 *	without restriction, including without limitation the rights to use, copy, modify, 
 *	merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 
 *	permit persons to whom the Software is furnished to do so, subject to the following 
 *	conditions:
 *
 *	The above copyright notice and this permission notice shall be included in all copies
 *	or substantial portions of the Software.
 *
 *	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
 *	INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
 *	PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
 *	HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 *	CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
 *	OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
 * 
 *******************************************************************************************/

package flash.extension.panel
{
	import adobe.utils.MMExecute;

	public class PresetPanel
	{
		
		public static function addNewItem( namePath:String ):Boolean
		{
			var results:String = MMExecute("fl.presetPanel.addNewItem('" + namePath + "')");
			return (results == "true" ? true : false);
			
		}
		
		public static function applyPreset( presetPath:String ):Boolean
		{
			var results:String = MMExecute("fl.presetPanel.applyPreset('" + presetPath + "')");
			return (results == "true" ? true : false);
		}
		
		public static function deleteFolder( presetPath:String ):Boolean
		{
			var results:String = MMExecute("fl.presetPanel.deleteFolder('" + presetPath + "')");
			return (results == "true" ? true : false);
		}
		
		public static function deleteItem( namePath:String ):Boolean
		{
			var results:String = MMExecute("fl.presetPanel.deleteItem('" + namePath + "')");
			return (results == "true" ? true : false);
		}
		
		public static function expandFolder( expand:Boolean = true, recursive:Boolean = false, folderPath:String = null ):Boolean
		{
			var results:String = MMExecute("fl.presetPanel.expandFolder(" + expand + ", " + recursive + ", '" + folderPath + "')");
			return (results == "true" ? true : false);	
		}
		
		public static function exportItem(fileURI:String, namePath:String = null ):Boolean
		{
			var results:String = MMExecute("fl.presetPanel.expandFolder('" + fileURI + "', '" + namePath + "')");
			return (results == "true" ? true : false);	
		}
		
		public static function findItemIndex( presetName:String ):int
		{
			var results:String = MMExecute("fl.presetPanel.findItemIndex('" + presetName + "')");
			return results as int;			
		}

		/*
		public static function getSelectedItems():Array
		{
			
		}
		*/
		
		public static function importItem( fileURI:String, namePath:String = null ):Boolean
		{
			var results:String = MMExecute("fl.presetPanel.importItem('" + fileURI + "', '" + namePath + "')");
			return (results == "true" ? true : false);	
		}
		
		/*
		public static function get items():Array
		{
			
		}
		
		public static function set items( values:Array ):void
		{
			
		}
		*/
			
		public static function moveToFolder( folderPath:String, namePath:String = null ):Boolean
		{
			var results:String = MMExecute("fl.presetPanel.moveToFolder('" + folderPath + "', '" + namePath + "')");
			return (results == "true" ? true : false);
		}
		
		public static function newFolder( folderPath:String = null ):Boolean
		{
			var results:String = MMExecute("fl.presetPanel.newFolder('" + folderPath + "')");
			return (results == "true" ? true : false);
		}
		
		
		public static function renameItem( newName:String ):Boolean
		{
			var results:String = MMExecute("fl.presetPanel.renameItem('" + newName + "')");
			return (results == "true" ? true : false);			
		}
		
		public static function selectItem( namePath:String, replaceCurrentSelection:Boolean = true, select:Boolean = true):Boolean
		{
			var results:String = MMExecute("fl.presetPanel.selectItem('" + namePath + "', " + replaceCurrentSelection + ", " + select + ")");
			return (results == "true" ? true : false);			
		}
	}
}